/**
 * Created by c0001 on 2018/6/15.
 */
import axios from 'axios';

// 设置公共请求头
const init = function () {
  let url = window.location.search.toString()
  let arr = []
  let isArr = {}
  arr = url.split('&')
  arr.forEach(l => {
    l = l.split('=')
    isArr[l[0]] = l[1]
  })
  axios.defaults.headers.common['deviceChannel'] = 'gclife_bmp_pc';
  axios.defaults.headers.common['language'] = window.langKey;
  axios.defaults.headers.common['osType'] = isArr.osType || '';
  axios.defaults.headers.common['deviceId'] = isArr.deviceId || '';
  axios.defaults.headers.common['appVersion'] = isArr.appVersion || '';
  axios.defaults.headers.common['district'] = isArr.district || '';
  axios.defaults.headers.common['phoneModel'] = isArr.phoneModel || '';
  axios.defaults.headers.common['osVersion'] = isArr.osVersion || '';
  axios.defaults.headers.common['coordiate'] = isArr.coordiate || '';
  axios.defaults.headers.common['networkType'] = isArr.networkType || '';
  axios.defaults.headers.common['ipAddress'] = isArr.ipAddress || '';
}

export default {
  init
}
